import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;


public class ArrayReflect {
	public static void main(String[] args) {
		int[] list = new int[5];
		list[1]=1;
		list[2]=2;
		list[3]=3;
		list[4]=4;
		Object array =  growArray(list, 2);
		System.out.println(array);
	}
	
	public static Object growArray(Object array, int size) {
	    Class type = array.getClass().getComponentType();
	    Object grown = Array.newInstance(type, size);
	    System.arraycopy(array, 0, grown, 0,
	        Math.min(Array.getLength(array), size));
	    return grown;
	}
}
